<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="__CSS__/user.css" />
		<link rel="stylesheet" type="text/css" href="__CSS__/prompt.css" />

		<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-2.1.4.min.js"></script>
		<script src="__JS__/prompt.js" type="text/javascript" charset="utf-8"></script>
		<script src="__JS__/public.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="list-group">
			<h1>我的收藏</h1>
			<br />
			<div class="list-item">

			</div>
		</div>
		<script type="text/javascript">
			var isPC = {$isPC};
			var w_width, w_height;
			var setSize = function (){
				w_width = $(window).width();
				w_height = $(window).height();
				
				if(!isPC){
					$('.list-group').css({
						'padding-left': 10 + 'px',
						'padding-right': 10 + 'px',
					});
				}
				var item = $('.list-item');
				for(var x=0; x<item.length; x++){
					$('.division').eq(x).css({
						'width': item.eq(x).width(),
					});
				}
				
			}
			$(function(){
				$(window).resize(setSize);
				/*
				 * 绘制收藏列表
				 */
				function drawCollectionList(data){
					$('.list-group').children('.list-item').remove();
					for(var x in data){
						$('.list-group').append('<div class="list-item" answerid='+data[x]['answerid']+'>'+data[x]['title']+'   -  '+data[x]['author']+'</div><br><div class="division"></div>');
					}
					//绑定跳转事件
					$('.list-item').click(function(){
						console.log($(this).attr('answerid'));
						parent.setTextPage($(this).attr('answerid'));
						parent.selectContent('text');
					});
					setSize();
				}
				/*
				 * 请求数据
				 */
				ajax('{:U("User/getCollectList")}', 'openid='+getCookie('openid'), function(data){
					drawCollectionList(data);
				});
			});
		</script>
	</body>
</html>